/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Cong
 */
@Entity
@Table(name = "khuyenmai")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Khuyenmai.findAll", query = "SELECT k FROM Khuyenmai k"),
    @NamedQuery(name = "Khuyenmai.findById", query = "SELECT k FROM Khuyenmai k WHERE k.id = :id"),
    @NamedQuery(name = "Khuyenmai.findByTenchuongtrinh", query = "SELECT k FROM Khuyenmai k WHERE k.tenchuongtrinh = :tenchuongtrinh"),
    @NamedQuery(name = "Khuyenmai.findByNgaybatdau", query = "SELECT k FROM Khuyenmai k WHERE k.ngaybatdau = :ngaybatdau"),
    @NamedQuery(name = "Khuyenmai.findByNgayketthuc", query = "SELECT k FROM Khuyenmai k WHERE k.ngayketthuc = :ngayketthuc")})
public class Khuyenmai implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "tenchuongtrinh")
    private String tenchuongtrinh;
    @Basic(optional = false)
    @Column(name = "ngaybatdau")
    @Temporal(TemporalType.TIMESTAMP)
    private Date ngaybatdau;
    @Basic(optional = false)
    @Column(name = "ngayketthuc")
    @Temporal(TemporalType.TIMESTAMP)
    private Date ngayketthuc;

    public Khuyenmai() {
    }

    public Khuyenmai(Long id) {
        this.id = id;
    }

    public Khuyenmai(Long id, String tenchuongtrinh, Date ngaybatdau, Date ngayketthuc) {
        this.id = id;
        this.tenchuongtrinh = tenchuongtrinh;
        this.ngaybatdau = ngaybatdau;
        this.ngayketthuc = ngayketthuc;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTenchuongtrinh() {
        return tenchuongtrinh;
    }

    public void setTenchuongtrinh(String tenchuongtrinh) {
        this.tenchuongtrinh = tenchuongtrinh;
    }

    public Date getNgaybatdau() {
        return ngaybatdau;
    }

    public void setNgaybatdau(Date ngaybatdau) {
        this.ngaybatdau = ngaybatdau;
    }

    public Date getNgayketthuc() {
        return ngayketthuc;
    }

    public void setNgayketthuc(Date ngayketthuc) {
        this.ngayketthuc = ngayketthuc;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Khuyenmai)) {
            return false;
        }
        Khuyenmai other = (Khuyenmai) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gui.Khuyenmai[ id=" + id + " ]";
    }
    
}
